
//-----------------------------------------------
//              生成代码不要修改
//-----------------------------------------------

using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;

public class GoalInfoCfg
{
    public int ID;    //		ID
    public int Type;    //		类型
    public int conditionClusterType;    //		执行顺序
    public int conditionFinishType;    //		监听完成类型
    public List<int> conditionID;    //		监听执行ID
    public int executeClusterType;    //		执行顺序
    public int executeFinishType;    //		执行完成完成类型
    public List<int> executeID;    //		执行执行ID

    public void Deserialize (DynamicPacket packet)
    {
        ID = packet.PackReadInt32();
        Type = packet.PackReadInt32();
        conditionClusterType = packet.PackReadInt32();
        conditionFinishType = packet.PackReadInt32();
        conditionID = SheetGenCommonFunc.GetListInt(packet.PackReadString());
        executeClusterType = packet.PackReadInt32();
        executeFinishType = packet.PackReadInt32();
        executeID = SheetGenCommonFunc.GetListInt(packet.PackReadString());
    }
}

public class GoalInfoCfgMgr
{
    private static GoalInfoCfgMgr mInstance;
    
    public static GoalInfoCfgMgr Instance
    {
        get
        {
            if (mInstance == null)
            {
                mInstance = new GoalInfoCfgMgr();
            }
            
            return mInstance;
        }
    }

    private Dictionary<int, GoalInfoCfg> mDict = new Dictionary<int, GoalInfoCfg>();
    
    public Dictionary<int, GoalInfoCfg> Dict
    {
        get {return mDict;}
    }

    public void Deserialize (DynamicPacket packet)
    {
        int num = (int)packet.PackReadInt32();
        for (int i = 0; i < num; i++)
        {
            GoalInfoCfg item = new GoalInfoCfg();
            item.Deserialize(packet);
            if (mDict.ContainsKey(item.ID))
            {
                mDict[item.ID] = item;
            }
            else
            {
                mDict.Add(item.ID, item);
            }
        }
    }
    
    public GoalInfoCfg GetDataByID(int id)
    {
        if(mDict.ContainsKey(id))
        {
            return mDict[id];
        }
        
        return null;
    }
}
